﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Power.Models;
using Power.View.Dialog;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;

namespace Power.ViewModel.Dialog
{
    public class AddProjectViewModel : ViewModelBase
    {
        private AddProject model;
        public AddProjectViewModel(AddProject model)
        {
            this.model = model;
            Close = new RelayCommand(OnClose);
            CloseOK = new RelayCommand(OnCloseOK);
            ProvinceSelectList = Common.Common.GetProvinceList();
            CitySelectList = Common.Common.GetCityList();
        }

        private void OnClose()
        {
            this.model.DialogResult = false;
            this.model.Close();
        }

        private void OnCloseOK()
        {
            this.model.DialogResult = true;
            this.model.Close();
        }

        #region 
        public RelayCommand Close { get; private set; }
        public RelayCommand CloseOK {  get; private set; }
        #endregion

        #region 数据绑定
        private List<SelectListItem> provinceSelectList;
        public List<SelectListItem> ProvinceSelectList
        {
            get => provinceSelectList;
            set
            {
                provinceSelectList = value;
                RaisePropertyChanged();
            }
        }

        private List<SelectListItem> citySelectList;
        public List<SelectListItem> CitySelectList
        {
            get => citySelectList;
            set
            {
                citySelectList = value;
                RaisePropertyChanged();
            }
        }
        #endregion
    }
}
